//************************************************************************
/// <copyrigth>2024-2025 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// Cross-Platform process operation
///</describe>
/// <date>2024/4/14</date>
///***********************************************************************
#ifndef PROCESS_H
#define PROCESS_H

#include <string>
#include <vector>
#include "ModuleLoader/ModuleConfig.h"

namespace SystemTool
{
    class CLASS_ITEM Process
    {
    public:
        // Launch the process(0: normal other: process exit code)
        static int Launch(std::string strExeFilePath,
                          std::vector<std::string> &vArgTable,
                          int &iPid,    // Process id
                          std::string strInitialDirectory = "",
                          bool bIsWaitForExit = false);

        // Is process running
        static bool IsRunning(int iPid);

        // Kill a process
        static void Kill(int iPid);

        // Get current process id
        static int GetCurProcessId();

        // Get current process excuted time in system's user mode kernal
        static long GetCurProcessUserModeConsumeTime();

        // Get current process excuted time in system's user mode kernal
        static long GetCurProcessKernalModeConsumeTime();
    };
}

#endif // PROCESS_H
